package com.wenhao.iqiyi;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-08-22 15:34
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String s = scanner.nextLine();
            String[] split = s.split(",");
            int[] y = new int[split.length];
            for (int i = 0;i < split.length;i++) {
                y[i] = Integer.parseInt(split[i]);
            }
            int preDown = y[0];
            int preUp = y[0];
            int max = 0;
            for (int i = 1;i < y.length;i++) {
                if (y[i] < y[i - 1]) {
                    preDown = y[i];
                    max = Math.max(preUp - y[i],max);
                } else {
                    preUp = y[i];
                    max = Math.max(y[i] - preDown,max);
                }
            }
            System.out.println(max);
        }
    }
}
